package com.note.simpleshop.module.goods.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@RestController
/**
 * kafka生产者
 *
 */
@RequestMapping("kafka")
public class KafkaProducer {
    @Autowired
    private KafkaTemplate kafkaTemplate;
    //发送消息方法
    @RequestMapping("/sendMsg")
    public void send() {
        kafkaTemplate.send("test","我是生产者发过来的消息");
    }
}